<!--#include file="main.inc.asp"-->
<!--#include file="applicationStore.inc.asp"-->

<% 
Call aspwebcache_run(1)

Sub aspwebcache_run(timeout)
	'@param timeout: cache expire time (in minutes)
	Dim awc, url, mode, timestart, page
	timestart = timer()

	'initialize the web cache and tell it to store in the application object
	Set awc = new aspwebcache
	awc.init("applicationObject")
	'Retreive aspWebCache parameter
	mode = Request.QueryString("aspwebcache")
	'if the parameter is bypass, abort sub and continue to page.
	if mode = "bypass" then exit sub
	'Get url
	dim protocol, host, pi, qs
	If Request.ServerVariables("HTTPS") = "off" Then
		protocol = "http"
	Else
		protocol = "https"
	End If
	host = Request.ServerVariables("HTTP_HOST")
	pi = Request.ServerVariables("PATH_INFO")
	qs = Request.ServerVariables("QUERY_STRING")
	url = protocol & "://" & host & pi
	If qs <> "" Then url = url & "?" & qs
	'Remove parameter aspwebcache (if exists) from url
	url = awc.removeURLParam(url, "aspwebcache")

	'Get the page identified by the url
	page = awc.run(url, mode)
	Set awc = Nothing
	
	'display the page
	Response.Write page
	Response.Write vbNewLine & "<!-- loaded in " & timer() - timestart & " seconds by aspwebcache -->" & vbNewLine
	Response.End()
End Sub
%>